package Test_0914;

/**
 * Created with Intellij IDEA
 * Description:
 * User: 星辰
 * Dare: 2024-09-14
 * Time: 19:36
 */
public class Test_0914 {
    //转换
    public static void main(String[] args) {
        
    }
    //查找
    public static void main1(String[] args) {
        String s1="hello";
        //要加小括号
        for (int i = 0; i < s1.length(); i++) {
            //不能直接打印，要通过charAtl来查找下标
            //System.out.println(s1[i]);
            char ch= s1.charAt(i);
            System.out.println(ch);
        }
        System.out.println("=======");
        //indextOf查找字符所在的下标，默认从0开始找
        int index = s1.indexOf('h');
        System.out.println(index);
        //从某个下标查找某个字符
        index=s1.indexOf('e',4);
        //可以找字符串
        index=s1.indexOf("ee");
        index=s1.indexOf("ee",4);
        int[] a={1,2,3,4};
        System.out.println(a.length);
        //从后往前找
        index=s1.lastIndexOf('l');
        index=s1.lastIndexOf('l',2);
        index=s1.lastIndexOf("ee");
        index=s1.lastIndexOf("ee",3);

    }
}
